﻿using System;
using System.Collections.Generic;
using System.Linq;
using Com.PhilChuang.Utils;
using Com.PhilChuang.Mobile.Apps.LocationSender.Model.Data;

namespace Com.PhilChuang.Mobile.Apps.LocationSender.Model.Services.Impl
{
	/// <summary>
	/// A very dumb implementation of ILocationSenderDao which just saves data in memory
	/// </summary>
	public class LocationSenderDaoMemoryImpl : ILocationSenderDao
	{
		private LocationSenderSettings m_Settings;
		private IEnumerable<String> m_Recipients;
		private GeoCoordinate m_GeoCoordinate;
		private GeoCoordinateFormat m_GeoCoordinateFormat;

		public void SaveSettings (LocationSenderSettings settings)
		{
			m_Settings = settings.Clone2 ();
		}

		public void SaveRecipients (IEnumerable<string> recipients)
		{
			m_Recipients = recipients.ToList ();
		}

		public void SaveGeoCoordinate (GeoCoordinate gc)
		{
			m_GeoCoordinate = gc.Clone2 ();
		}

		public void SaveGeoCoordinateFormat (GeoCoordinateFormat format)
		{
			m_GeoCoordinateFormat = format;
		}

		public LocationSenderSettings LoadSettings ()
		{
			return m_Settings.Clone2 ();
		}

		public IEnumerable<string> LoadRecipients ()
		{
			return m_Recipients.ToList ();
		}

		public GeoCoordinate LoadGeoCoordinate ()
		{
			return m_GeoCoordinate.Clone2 ();
		}

		public GeoCoordinateFormat LoadGeoCoordinateFormat ()
		{
			return m_GeoCoordinateFormat;
		}
	}
}
